package tpl

import (
	"bytes"
	"compress/gzip"
	"fmt"
	"io"
	"strings"
)

func bindata_read(data []byte, name string) ([]byte, error) {
	gz, err := gzip.NewReader(bytes.NewBuffer(data))
	if err != nil {
		return nil, fmt.Errorf("Read %q: %v", name, err)
	}

	var buf bytes.Buffer
	_, err = io.Copy(&buf, gz)
	gz.Close()

	if err != nil {
		return nil, fmt.Errorf("Read %q: %v", name, err)
	}

	return buf.Bytes(), nil
}

func agent_pkg_tpl_default_conf() ([]byte, error) {
	return bindata_read([]byte{
		0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x5c, 0x8e,
		0x51, 0x0a, 0xc2, 0x30, 0x0c, 0x86, 0xdf, 0x07, 0xbb, 0x43, 0x2e, 0xe0,
		0xea, 0xa3, 0xb0, 0xc3, 0x8c, 0xba, 0x65, 0x1a, 0xe8, 0x92, 0x91, 0x96,
		0xb5, 0x52, 0x7a, 0x77, 0x19, 0xad, 0x28, 0xe6, 0x21, 0xfc, 0x7c, 0x1f,
		0x21, 0xbf, 0x47, 0x3d, 0x50, 0x21, 0xf7, 0x1d, 0x00, 0x80, 0x23, 0x1f,
		0x90, 0xe1, 0x76, 0x1d, 0xfb, 0xae, 0x12, 0x15, 0x09, 0x60, 0x0e, 0xab,
		0x26, 0xc6, 0x68, 0x9e, 0x61, 0x73, 0x63, 0x15, 0xc4, 0x0b, 0xa6, 0xba,
		0x87, 0x13, 0x7f, 0x63, 0x4b, 0xfc, 0x20, 0x4e, 0x97, 0x05, 0xef, 0x64,
		0x79, 0xf8, 0x39, 0xac, 0x1f, 0x27, 0xb6, 0x1b, 0xc2, 0xd4, 0x98, 0x93,
		0xd9, 0x06, 0x12, 0x06, 0xf3, 0x69, 0x72, 0xce, 0xae, 0x92, 0x5e, 0x93,
		0xe2, 0x42, 0x8a, 0x73, 0x00, 0x59, 0xd7, 0xf1, 0x5f, 0xee, 0xd6, 0x7b,
		0xc8, 0x79, 0x28, 0xa5, 0xa9, 0xd2, 0x77, 0xe5, 0x1d, 0x00, 0x00, 0xff,
		0xff, 0x15, 0xba, 0xc3, 0xda, 0xd4, 0x00, 0x00, 0x00,
	},
		"agent/pkg/tpl/default.conf",
	)
}

func agent_pkg_tpl_nginx_ext_conf() ([]byte, error) {
	return bindata_read([]byte{
		0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x5c, 0x8e,
		0x51, 0x0a, 0x83, 0x30, 0x0c, 0x86, 0xdf, 0x05, 0xef, 0x90, 0x0b, 0xcc,
		0xfa, 0x2a, 0x1e, 0x46, 0x3a, 0x8d, 0x5b, 0x40, 0x13, 0x49, 0x8b, 0xed,
		0x28, 0xbd, 0xfb, 0x90, 0x76, 0x6c, 0x2c, 0x0f, 0xe1, 0xe7, 0xfb, 0x08,
		0xf9, 0x1d, 0xea, 0x89, 0x0a, 0xa9, 0x6d, 0x00, 0x00, 0x36, 0x72, 0x1e,
		0x19, 0x86, 0x7e, 0xe8, 0xc7, 0xb6, 0x29, 0x4c, 0x45, 0x3c, 0x98, 0xd3,
		0xaa, 0x09, 0x21, 0x98, 0xa7, 0xdf, 0xb7, 0xb1, 0x08, 0xe2, 0x05, 0x63,
		0xd9, 0xdd, 0x85, 0xbf, 0xb1, 0x26, 0x7e, 0x10, 0xc7, 0xdb, 0x82, 0x77,
		0xb2, 0xdc, 0xfd, 0x1c, 0x96, 0x9f, 0x13, 0xdb, 0x1d, 0x61, 0xaa, 0x6c,
		0x93, 0xd9, 0x7a, 0x12, 0x06, 0xf3, 0xe9, 0x72, 0xcd, 0xa1, 0x12, 0x5f,
		0x93, 0xe2, 0x42, 0x8a, 0xb3, 0x07, 0x59, 0xd7, 0xf1, 0x5f, 0x1e, 0xd6,
		0x39, 0x48, 0xa9, 0xcb, 0xb9, 0xaa, 0xdc, 0x36, 0xf9, 0x1d, 0x00, 0x00,
		0xff, 0xff, 0x1f, 0x02, 0x1b, 0x6c, 0xd6, 0x00, 0x00, 0x00,
	},
		"agent/pkg/tpl/nginx-ext.conf",
	)
}

// Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
func Asset(name string) ([]byte, error) {
	cannonicalName := strings.Replace(name, "\\", "/", -1)
	if f, ok := _bindata[cannonicalName]; ok {
		return f()
	}
	return nil, fmt.Errorf("Asset %s not found", name)
}

// AssetNames returns the names of the assets.
func AssetNames() []string {
	names := make([]string, 0, len(_bindata))
	for name := range _bindata {
		names = append(names, name)
	}
	return names
}

// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() ([]byte, error){
	"agent/pkg/tpl/default.conf": agent_pkg_tpl_default_conf,
	"agent/pkg/tpl/nginx-ext.conf": agent_pkg_tpl_nginx_ext_conf,
}
// AssetDir returns the file names below a certain
// directory embedded in the file by go-bindata.
// For example if you run go-bindata on data/... and data contains the
// following hierarchy:
//     data/
//       foo.txt
//       img/
//         a.png
//         b.png
// then AssetDir("data") would return []string{"foo.txt", "img"}
// AssetDir("data/img") would return []string{"a.png", "b.png"}
// AssetDir("foo.txt") and AssetDir("notexist") would return an error
// AssetDir("") will return []string{"data"}.
func AssetDir(name string) ([]string, error) {
	node := _bintree
	if len(name) != 0 {
		cannonicalName := strings.Replace(name, "\\", "/", -1)
		pathList := strings.Split(cannonicalName, "/")
		for _, p := range pathList {
			node = node.Children[p]
			if node == nil {
				return nil, fmt.Errorf("Asset %s not found", name)
			}
		}
	}
	if node.Func != nil {
		return nil, fmt.Errorf("Asset %s not found", name)
	}
	rv := make([]string, 0, len(node.Children))
	for name := range node.Children {
		rv = append(rv, name)
	}
	return rv, nil
}

type _bintree_t struct {
	Func func() ([]byte, error)
	Children map[string]*_bintree_t
}
var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
	"agent": &_bintree_t{nil, map[string]*_bintree_t{
		"pkg": &_bintree_t{nil, map[string]*_bintree_t{
			"tpl": &_bintree_t{nil, map[string]*_bintree_t{
				"default.conf": &_bintree_t{agent_pkg_tpl_default_conf, map[string]*_bintree_t{
				}},
				"nginx-ext.conf": &_bintree_t{agent_pkg_tpl_nginx_ext_conf, map[string]*_bintree_t{
				}},
			}},
		}},
	}},
}}
